﻿using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class BulletPath
    {
        public virtual Vector3 GetPosition(float time)
        {
            return Vector3.zero;
        }
    }

    public class BulletPath_Curve : BulletPath
    {
        private int curveIndex;
        public void Initialize(int nCurveIndex)
        {
            this.curveIndex = nCurveIndex;
        }
        public override Vector3 GetPosition(float time)
        {
            if (this.curveIndex >= 0 && this.curveIndex < BulletGlobal.Count)
            {
                var rConfig = BulletGlobal.GetConfig(this.curveIndex);
                return new Vector3(rConfig.x.Evaluate(time), rConfig.y.Evaluate(time), rConfig.z.Evaluate(time));
            };
            return base.GetPosition(time);
        }
    }
}